import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] count = new int[n + 2]; // 统计每个评分的次数
        for (int i = 0; i < n; i++) {
            int score = scan.nextInt();
            count[score]++;
        }

        int q = scan.nextInt();
        List<Integer> results = new ArrayList<>();
        for (int i = 0; i < q; i++) {
            int x = scan.nextInt();
            int current = x;
            int increase = 0;
            while (current <= n && count[current] > 0) {
                increase += count[current];
                current += 1;
            }
            results.add(increase);
        }

        // 一次性输出所有结果

        for (int result : results) {
            System.out.println(result);
        }
    }
}